1. Field of the Invention
The present invention relates to a technology of effectively using virtual memory resources in a computer system implementing a generational garbage collection.
2. Description of the Related Art
One of the memory managing functions implemented in a computer system can be generational garbage collection (hereinafter referred to as GC). The GC is a function of automatically releasing an area which has become unnecessary in a memory area dynamically reserved by a program. The GC can come in various types depending on the algorithm such as a mark sweep type, a copy type, a train type, a parallel type, a concurrent type, etc., and any of these algorithms can be combined as generational GC.
The generational GC divides a memory space used by an application program (hereinafter referred to simply as an application), and classifies the divided spaces depending on the life of an object (generation), thereby improving the collection efficiency of dead objects per process unit. A short-lived object marks a high collection probability, and a long-lived object marks a low collection probability.
The generational GC performs a process with a virtual memory space allocated independently for each generation. For example, when the generational GC covers two generations, for example, a new generation and an old generation, a virtual memory space is independently allocated to each of the new and old generations. Although a virtual memory space is not prescribed for generational GC, a virtual memory space is independently allocated to each generation.
Relating to the generational GC, for example, Japanese Published Patent Application No. 2001-184219 (hereinafter referred to as “patent document 1”) describes a method of determining a generation area to be allocated by analyzing a source program including an instruction to reserve a dynamic variable area for a dynamic variable, and analyzing a variable characteristic about the existence of a dynamic variable when a dynamic variable area is allocated to any of a plurality of generation areas.
When a computer system representing a memory address of 32 bits is used, a virtual memory space can acquire 4 GB (gigabytes) at most. However, since a virtual memory space is normally distributed to the OS (operating system) and other computer systems, and also to the instruction, data, stack area in the computer system, the capacity is practically smaller than 4 GB.
For example, in the computer system implementing two-generation generational GC of, for example, a new generation and an old generation, if the computer system can use the entire virtual memory space, 1 GB of virtual memory space is allocated to the new generation and 3 GB of virtual memory space is allocated to the old generation, when the computer system is initialized, then the virtual memory space is allocated independently to each generation. Therefore, the virtual memory space cannot be dynamically reallocated although it is determined that the memory of as much as 3 GB is unnecessary for the old generation and a higher process efficiency can be attained by committing (actually allocating existing memory resources to a virtual memory space) the memory of 2 GB to the new generation during the operation. Accordingly, in this case, the operation of the computer system is reactivated and the virtual memory space is reallocated, or the process is continued with the current allocation of the virtual memory space and the current inefficient rate. This is the problem with the computer system implementing the generational GC of three or more generations, and also with the system described in the above-mentioned patent document 1.